package demo.spring.cloud.eureka.consumer;

import dmeo.spring.cloud.eureka.provider.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

/**
 * Created by lushun.chen on 2017/4/7.
 *
 * @author lushun.chen
 */
@Service
public class RibbonService {
    @Autowired
    private RestTemplate restTemplate;

    /**
     * microservice-provider-user 服务提供者的serice_id
     */
    public User findById(Long id) {
        return this.restTemplate.getForObject("http://microservice-provider-user/" + id, User.class);
    }
}
